package com.tencent.cloud.iov.util.rx;

import android.support.annotation.CallSuper;

import com.tencent.mars.xlog.Log;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * Observer 默认实现
 *
 * 添加日志打印以跟踪流程或异常
 *
 * @author showxiao
 * @date 2018/3/27
 */

public class SimpleObserver<T> implements Observer<T> {

    private final String mTag = "SimpleObserver_" + getClass().getSimpleName();

    @CallSuper
    @Override
    public void onSubscribe(Disposable d) {
        Log.d(mTag, "onSubscribe() called with: d = [" + d + "]");
    }

    @CallSuper
    @Override
    public void onNext(T t) {
        Log.d(mTag, "onNext() called with: t = [" + t + "]");
    }

    @CallSuper
    @Override
    public void onError(Throwable e) {
        Log.e(mTag, "onError: " + e);
    }

    @CallSuper
    @Override
    public void onComplete() {
        Log.d(mTag, "onComplete() called");
    }
}
